<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>mrdForm</title>
    <link rel="stylesheet" type="text/css"
          href="../css/jquery/jquery-ui-1.8.23.custom.css" media="screen"/>
    <link rel="stylesheet" type="text/css"
          href="../css/jqgrid/ui.jqgrid.css" media="screen"/>
    <script type="text/javascript" src="../js/jquery/jquery-1.8.0.min.js"></script>
    <script type="text/javascript"
            src="../js/jquery/jquery-ui-1.8.23.custom.min.js"></script>
    <script type="text/javascript" src="../js/jqgrid/i18n/grid.locale-cn.js"></script>
    <script type="text/javascript" src="../js/jqgrid/jquery.jqGrid.min.js"></script>
    <script type="text/javascript" src="../js/form/jquery.mrd.form.js"></script>
    <script type="text/javascript" src="../js/base/constants.js"></script>
</head>
<script type="text/javascript">
    $(document).ready(function () {
        $("#mrdForm").mrdForm({
            title: "查询表单",// 表单标题
            columns: [{
                name: "id",
                label: "编号"
            }, {
                name: "c_name",
                label: "栏目"
            }, {
                name: "regDate",
                label: "时间",
                type: "date"
            }, {
                name: "c_type",
                label: "类型",
                type: "dropdown",
                data: [["普通栏目", "0"], ["文章栏目", "1"], ["图片栏目", "2"], ["附件栏目", "3"]],
                dropdownType: "ajax",
                url: "test-dropdown",
                success: function (data) {
                    var array = new Array();
                    $.each(data.dropdown, function (i, n) {
                        array.push([i, n]);
                    });
                    return array;
                }
            }],
            buttons: {
                'custom': [{id: "teset", value: "测试"}, {
                    id: "shenhe", value: "审核", click: function () {
                        alert("审核");
                    }
                }]
            },
            grid: {
                id: "columnGrid",
                url: "test-showColumns",
                colNames: ['id', '栏目', '类型', '状态', '注册时间', '备注'],
                colModel: [
                    {name: 'id', index: 'id', width: 100, sorttype: "int", search: true},
                    {name: 'c_name', index: 'c_name', width: 30},
                    {name: 'c_type', index: 'c_type', width: 100},
                    {name: 'c_state', index: 'c_state', width: 80, align: "right"},
                    {name: 'regDate', index: 'regDate', width: 80, align: "right", sorttype: "date"},
                    {name: 'mark', index: 'mark', width: 80, align: "right"}
                ],
                title: "测试数据",
                sortname: "c_name",
                //rowNum:5,
                jsonReader: {
                    //从哪个json对象中取值
                    root: "columns"
                }
            }
        });
        $("#mrdForm").mrdForm("resize");
    });
</script>
<body>
<div id="mrdForm"></div>
</body>
</html>
